﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CandooMwrf
{
    public partial class FrmTools : Form
    {
        public FrmTools()
        {
            InitializeComponent();
        }

        private void btnGenScrect_Click(object sender, EventArgs e)
        {
            #region 批量生成卡密码
            Random r = new Random();
            byte[] bytes = new byte[6];

            var t = new StringBuilder();
            for (int j = 0; j < 16; j++)
            {
                r.NextBytes(bytes);
                t.AppendLine("KeyA[" + j + "] = \"" + ByteHexHelper.ByteToHex(bytes) + "\";");
            }
            for (int j = 0; j < 16; j++)
            {
                r.NextBytes(bytes);
                t.AppendLine("KeyB[" + j + "] = \"" + ByteHexHelper.ByteToHex(bytes) + "\";");
            }

            byte[] bytesDesKey = new byte[8];
            for (int j = 0; j < 16; j++)
            {
                r.NextBytes(bytesDesKey);
                t.AppendLine("DesKey[" + j + "] = \"" + ByteHexHelper.ByteToHex(bytesDesKey) + "\";");
            }
            
            txtMsg.Text = t.ToString();
            #endregion
        }
    }
}
